<html>
<head>
<title>08 函数</title>
</head>
<body>
	<script type="text/javascript">
		/*

		
		*/


		function Person(name , age){
			
			//向对象中添加属性
			this.name = name;
			this.age= age;
		
		}



		var per = new Person("孙悟空",518);
		var per1 = new Person("猪八戒",18);

		per.toString = function(){
			return "Person[name = "+this.name+",age="+this.age+"]"
		}


		Person.toString = function(){
			return "Person[name = "+this.name+",age="+this.age+"]"
		}
		
		var result = per.toString();
		var result1 = per1.toString();
		console.log(per);
		console.log(per1);
	</script>
</body>


</html>
